package com.formula.datastructure.exam.stack;

import com.formula.datastructure.util.DataUtil;

public class SqStack {
    Integer[] array;
    int front = -1;

    public void init() {
        array = new Integer[50];
    }

    public void push(Integer data) {
        array[++front] = data;
    }

    public Integer pop() {
        Integer result = array[front];
        array[front--] = null;
        return result;
    }

    public boolean isEmpty() {
        return front == -1;
    }

    public static void main(String[] args) {
        SqStack stack = new SqStack();
        stack.init();
        Integer[] input = DataUtil.genArray(10, 99);
        for (int i = 0; i < input.length; i++) {
            stack.push(input[i]);
        }
    }
}
